const path = require('path');
const express = require('express');
const multipart = require('connect-multiparty');

let app = express();

//调用上传文件模块
let mutipartMiddeware = multipart(); //调用模块

//设置文件的上传目录
app.use(multipart({uploadDir:"assets/uploads/"}));


//构建
const WeeklyRouter = express.Router();

//引入控制器
const WeeklyController = require(path.join(__dirname,"../controllers/WeeklyController"));


//账号列表页面
WeeklyRouter.get('/weeklyList',WeeklyController.weeklyList);

//账号添加页面
WeeklyRouter.get('/weeklyAdd',WeeklyController.weeklyAdd);

//账号添加post处理
WeeklyRouter.post('/weeklyAdd',mutipartMiddeware,WeeklyController.weeklyAddForm);

//账号编辑页面
WeeklyRouter.get('/weeklyEdit',WeeklyController.weeklyEdit);

//账号编辑post处理
WeeklyRouter.post('/weeklyEdit',mutipartMiddeware,WeeklyController.weeklyEditForm);

//账号删除
WeeklyRouter.get('/weeklyDelete',WeeklyController.weeklyDelete);

module.exports = WeeklyRouter;